package com.galen.chapter1.service;

import com.galen.chapter1.entity.User;
import com.galen.chapter1.repository.UserRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户服务接口实现类
 *
 * @author GalenGao
 * @version Id: UserServiceImpl.java, v 0.1 2022/2/24 12:15 上午 GalenGao Exp $$
 */
@Service
@RequiredArgsConstructor
public class UserServiceImpl implements UserService {

    private final UserRepository userRepository;

    @Override
    public User save(User user) {
        return userRepository.save(user);
    }

    @Override
    public List<User> findUserLikeByName(String name) {
        return userRepository.findAllByNameLike(name);
    }
}
